<?php
/*
填写退货信息
*/
include('../conn.php');

// 需传参数 
$id = $_REQUEST['id'];
$express = $_REQUEST['express'];
$expressNum = $_REQUEST['expressNum'];
// 需传参数 end

// 状态
$state4 = 4;
// 状态 end

// 时间
$datetime = date("Y-m-d H:i:s");
// 时间 end

if ($id != '' && $express != '' && $expressNum != '') {
	$query = mysql_query("UPDATE tuihuo set state=".$state4.",expressNum='".$expressNum."',express='".$express."',3time='".$datetime."' where id=".$id);

	if (mysql_affected_rows()>0) {
		$arr = array('code' => 200, 'msg' => '添加成功');

		// 定时器
		$days = 12;
		$url = "http://120.24.0.10/xzpf/changeAfterTime/changeTuihuoState.php?id=".$id."";
		$start_date = date("Y-m-d",strtotime(''.$days.'days'));
		$start_hour = date("H");
		$start_minute = date("i");
		$tag = 'setTuihuoState';
		$loop = 1;

		$apiUrl = "http://120.24.0.10/unitask/core/func.add.php?url=".$url."&start_date=".$start_date."&start_hour=".$start_hour."&start_minute=".$start_minute."&tag=".$tag."&loop=".$loop."";
		file_get_contents($apiUrl);
		// 定时器 end

	}else{
		$arr = array('code' => 201, 'msg' => '添加失败');
	}
}else{
	$arr = array('code' => 400, 'msg' => 'id或express或expressNum不存在');
}
echo json_encode($arr);
